<template>
  <div class="header-container">
    <div class="l-content">
    </div>
    <div class="r-content">
      <el-dropdown @command="handleCommand">
                <span class="el-dropdown-link">
                    <img class="user" src="https://storage-public.zhaopin.cn/CompanyLogo/20160920/57050C54A0A944E6B71869420F2F7352.jpg" alt="">
                </span>
        <el-dropdown-menu slot="dropdown">
<!--          <el-dropdown-item>个人信息</el-dropdown-item>-->
          <el-dropdown-item command="logout">退出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
export default {
  methods:{
    handleCommand(){
      console.log('logout')
      sessionStorage.removeItem("token");
      this.$router.push("/login")
    },
    handleMenu(){
      // 相当于调用这个方法
      this.$store.commit('CollapseMenu')
    }
  }
}
</script>

<style lang="less" scoped>
.header-container {
  background-color: #ffffff;
  height: 60px;

  // 让按钮和头像居中
  display: flex;
  justify-content: space-between;
  align-items: center;
  // 不要紧贴边框
  padding: 0 20px;

  .el-dropdown-link {
    cursor: pointer;
    color: #409EFF;

    .user {
      width: 40px;
      height: 40px;
      // 50%变圆形
      border-radius: 50%;
    }
  }
}
</style>
